﻿using System;

namespace D.UtilEventbus
{
    /// <summary> 
    /// 事件发布者，就是发送事件到EventBus事件总线的一方，事件发布者调用Post()方法，将事件发给EventBus。可以在程序的任何地方，调用EventBus的post()方法，发送事件给EventBus
    /// </summary>
    public interface ISubscriber
    {
        /// <summary>
        /// 事件订阅
        /// </summary>
        /// <typeparam name="TEventData"></typeparam>
        /// <param name="eventHandler"></param>
        void Subscribe<TEventData>(Type eventHandler);

        /// <summary>
        /// 删除事件订阅
        /// </summary>
        /// <typeparam name="TEventData"></typeparam>
        /// <param name="eventHandler"></param>
        void UnSubscribe<TEventData>(Type eventHandler);

        ///// <summary>
        ///// 订阅指定事件数据的事件处理类型
        ///// </summary>
        ///// <typeparam name="TEventData">事件数据类型</typeparam>
        ///// <typeparam name="TEventHandler">事件处理器类型</typeparam>
        //public void Subscribe<TEventData, TEventHandler>() where TEventData : IEventData where TEventHandler : IEventHandler, new();

        ///// <summary>
        ///// 订阅指定事件数据的事件处理委托
        ///// </summary>
        ///// <typeparam name="TEventData">事件数据类型</typeparam>
        ///// <param name="action">事件处理委托</param>
        //public void Subscribe<TEventData>(Action<TEventData> action) where TEventData : IEventData;

        ///// <summary>
        ///// 订阅指定事件数据的事件处理对象
        ///// </summary>
        ///// <typeparam name="TEventData">事件数据类型</typeparam>
        ///// <param name="eventHandler">事件处理对象</param>
        //public void Subscribe<TEventData>(IEventHandler eventHandler) where TEventData : IEventData;

        ///// <summary>
        ///// 订阅指定事件数据的事件处理对象
        ///// </summary>
        ///// <param name="eventType">事件数据类型</param>
        ///// <param name="eventHandler">事件处理对象</param>
        //public void Subscribe(Type eventType, IEventHandler eventHandler);

        ///// <summary>
        ///// 自动订阅所有事件数据及其处理类型
        ///// </summary>
        ///// <param name="eventHandlerTypes">事件处理器类型集合</param>
        //public void SubscribeAll(Type[] eventHandlerTypes);

        ///// <summary>
        ///// 取消订阅指定事件数据的事件处理委托
        ///// </summary>
        ///// <typeparam name="TEventData">事件数据类型</typeparam>
        ///// <param name="action">事件处理委托</param>
        //public void Unsubscribe<TEventData>(Action<TEventData> action) where TEventData : IEventData;

        ///// <summary>
        ///// 取消订阅指定事件数据的事件处理对象
        ///// </summary>
        ///// <typeparam name="TEventData">事件数据类型</typeparam>
        ///// <param name="eventHandler">事件处理对象</param>
        //public void Unsubscribe<TEventData>(IEventHandler<TEventData> eventHandler) where TEventData : IEventData;

        ///// <summary>
        ///// 取消订阅指定事件数据的事件处理对象
        ///// </summary>
        ///// <param name="eventType">事件数据类型</param>
        ///// <param name="eventHandler">事件处理对象</param>
        //public void Unsubscribe(Type eventType, IEventHandler eventHandler);

        ///// <summary>
        ///// 取消指定事件数据的所有处理器
        ///// </summary>
        ///// <typeparam name="TEventData">事件数据类型</typeparam>
        //public void UnsubscribeAll<TEventData>() where TEventData : IEventData;

        ///// <summary>
        ///// 取消指定事件数据的所有处理器
        ///// </summary>
        ///// <param name="eventType">事件数据类型</param>
        //public void UnsubscribeAll(Type eventType);
    }
}
